<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title> 小程序管理系统</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">

    <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css"  media="all">
    <style type="text/css">
        .layui-table{
            text-align: center;
        }
        .layui-table td, .layui-table th{
            text-align: center;
        }
    </style>
</head>
<body>
    <form action="{:U('Adv/addShopAdv')}" method="post">
        <input type="text" style="width: 30%;height: 18px;" placeholder="商家名称/类型" name="name">
        <input type="submit" value="搜索" style="background-color: #01AAED;color: white;font-size: 14px;border: 0px;padding: 2px 5px;">
    </form>
    <table class="layui-table">
        <colgroup>
            <col width="100">
        </colgroup>
        <thead>
        <tr>
            <th>ID</th>
            <th>店铺名称</th>
            <th>店铺Logo</th>
            <th>类型</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <foreach name="list" item="v">
            <tr>
                <td>{$v.shop_id}</td>
                <td>{$v.name}</td>
                <td><img src="{$v.logo_url}" style="width: 60px;height: 50px;"/></td>
                <td>{$v.cate}</td>
                <td>
                    <button data-id="{$v.shop_id}" class="add layui-btn layui-btn-small">确认添加</button>
                </td>
            </tr>
        </foreach>
        <tr>
            <td colspan="5">{$show}</td>
        </tr>
        </tbody>
    </table>
    <script src="__PUBLIC__/layui/layui.js" charset="utf-8"></script>
    <script>
        //JavaScript代码区域
        layui.use(['element','laypage','layer'], function(){
            var element = layui.element
                    ,$ = layui.jquery
                    ,layer = layui.layer
                    ,laypage = layui.laypage;

            $(".add").click(function(){
                var id = $(this).data('id');
                $.post("{:U('doAddShopAdv')}", {id: id}, function(e) {
                    if(e.status == 1){
                        layer.msg(e.info,{icon: 6,time:1000});
                        setTimeout("window.history.back(-1);window.location.href = 'https://www.58zltc.com/index.php/Tongcheng/Adv/shopAdv/status/0.html';",1000);
                    }else{
                        layer.msg(e.info,{icon:1,time:1000});
                    }
                });
            });
        });
    </script>
</body>
</html>